if exists (select 1 from sysobjects where name = 'del_abteilung' and type = 'P')
begin
   drop procedure del_abteilung
   print 'Procedure: del_abteilung deleted ...'
end
go

create procedure del_abteilung(
  @abteilungid          int   = 1
)
as
begin

  set nocount on

  declare @beschrid int 
   select @beschrid = BeschrID
     from Abteilung
    where AbteilungID = @abteilungid

  delete from Abteilung where AbteilungID = @abteilungid

  exec del_beschreibung @beschrid

end
go

print 'Procedure: del_abteilung done ...'
go

grant exec on del_abteilung to prsadmins with grant option
go
grant exec on del_abteilung to prsusers
go

